<template>
  <!-- 用suspense来异步加载组件 -->
  <Suspense>
    <template v-slot:defalut>
      <Dialog></Dialog>
    </template>
    <!-- 展示加载中的画面 -->
    <template v-slot:fallback>
        <h3>loading...</h3>
    </template>
  </Suspense>
</template>

<script>
  // 引入一个方法
  // import Dialog from './components/Dialog.vue'
  import {defineAsyncComponent} from 'vue'
  // 异步引入
  const Dialog = defineAsyncComponent(()=>import('./components/Dialog.vue'))
  export default {
    name:"App",
    components:{Dialog},
  }
</script>
